Repository navigation
Find rfl::Short and rfl::Positional through other wrappers in rfl::cli - #790
Draft
clockblocker wants to merge 2 commits into
Draft
clockblocker wants to merge 2 commits into
clockblocker wants to merge 2 commits into
Conversation
rfl::cli decided after parsing which short options were bool flags, so a token a flag had taken went back to the positional arguments ahead of the others: `x -v y` gave a=y, b=x. rfl::cli::read now derives an internal option table from the struct (rfl::cli::internal::make_options, options.hpp) and parses with it, so it knows while parsing what each short option does with the next token: - Positional arguments keep their command-line order: `x -v y` gives a=x, b=y. - Short<"q", std::optional<bool>> and Short<"q", DefaultVal<bool>> are flags: `-q in.txt` leaves in.txt positional. - `-o` without a value fails with "Missing value for option '-o'.", and `-v=x` on a bool short flag fails to cast x. - A root rfl::NamedTuple whose field names the processors change reads its Short and Positional fields. - "Duplicate short name" is reported before errors in the arguments. The public parse_argv and resolve_args keep working without the table. Co-Authored-By: Claude Opus 5.5 <[email protected]>
rfl::cli only recognized rfl::Short and rfl::Positional as the outermost wrapper of a field, so `rfl::Description<"...", rfl::Short<"o", T>>` had no `-o` and `std::optional<rfl::Positional<T>>` was not positional. The option table now finds them through DefaultVal, std::optional, Description, Rename and Deprecated, in any order. Every Short and Positional counts wherever it sits: positional fields take bare arguments in declaration order, two fields with the same short name are an error, and a field with more than one Short or Positional does not compile. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Finds
rfl::Shortandrfl::Positionalthroughrfl::DefaultVal,std::optional,rfl::Description,rfl::Rename, andrfl::Deprecatedin any nesting order inrfl::cli.Example
Key details
ShortandPositionalbehaves identically to a bare one (flags, value options, declaration-order positionals, duplicate-short checks).Short/Positionalwrappers on the same field (e.g.Short<"o", Description<"...", Positional<T>>>) is now a compile-time error instead of silently ignoring the inner one.rfl::Renamestill applies only as the outermost wrapper.cli.md("Combining wrappers").AI-authored.